package com.reform.mapper;

import com.reform.pojo.project.SimplifyProjectInfo;
import com.reform.pojo.project.ViewProjectMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * VIEW Mapper 接口
 * </p>
 *
 * @author mortale
 * @since 2021-10-18
 */
@Mapper
public interface ViewProjectMemberMapper extends BaseMapper<ViewProjectMember> {

    @Select(
            "SELECT\n" +
                    "pro_id AS proId,\n" +
                    "pro_name AS proName,\n" +
                    "pro_department AS proDepartment,\n" +
                    "member_name AS memberName,\n" +
                    "pro_approval AS proApproval,\n" +
                    "member_dep AS memberDep\n" +
                    "FROM\n" +
                    "	view_project_member\n" +
                    "WHERE\n" +
                    "	view_project_member.batch_id IN ((SELECT batch_id from batch_phase WHERE phase_id = #{phaseId}))"
    )
    List<SimplifyProjectInfo> getSimplifyProjectByPhaseId(String phaseId);
}
